package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展厅验收记录
 * </p>
 *
 * @author linan
 * @date 2023-01-09
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "SpaceAcceptanceFinishStatusEnum", description = "完成状态 #{NEED_DEAL:待处理;HAS_DISPATCH:已派单;FINISHED:已完成;ACCEPTED:已验收;-枚举")
public enum SpaceAcceptanceFinishStatusEnum implements BaseEnum {

    /**
     * NEED_DEAL="待处理"
     */
    NEED_DEAL("待处理"),
    /**
     * HAS_DISPATCH="已派单"
     */
    HAS_DISPATCH("已派单"),
    /**
     * FINISHED="已完成"
     */
    FINISHED("已完成"),
    /**
     * ACCEPTED="已验收"
     */
    ACCEPTED("已验收"),
    /**
     * CANCEL="已取消"
     */
    CANCEL("已取消"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static SpaceAcceptanceFinishStatusEnum match(String val, SpaceAcceptanceFinishStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static SpaceAcceptanceFinishStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(SpaceAcceptanceFinishStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NEED_DEAL,HAS_DISPATCH,FINISHED,ACCEPTED", example = "NEED_DEAL")
    public String getCode() {
        return this.name();
    }

}
